//
//  HPHeaderView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/4.
//  Copyright © 2019 李文强. All rights reserved.
//

#import "HPHeaderView.h"

@implementation HPHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
    }
    return self;
}
- (void)initSubView{
    [self addSubview:self.topImageView];
    [self addSubview:self.nameLabel];
    [_topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.right.equalTo(@-10);
        make.top.equalTo(@5);
        make.bottom.equalTo(@-15);
    }];
     [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.height.equalTo(@10);
        make.bottom.equalTo(@0);
    }];
}
- (UIImageView *)topImageView{
    if (!_topImageView) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.image = [UIImage imageNamed:@"my_Resource"];
        _topImageView = imageView;
    }
    return _topImageView;
}
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        
        UILabel *lab = [UILabel titleColour:[UIColor colorWithHexString:@"0x333333"]
                                 titleFount:14
                                   pingfang:@"PingFang-SC-Regular"
                                  alignment:NSTextAlignmentCenter
                                  titleLine:1];
        lab.text = @"名字";
        _nameLabel = lab;
    }
    return _nameLabel;
}
@end
